package com.springbootmybatis.demo.api;

import com.springbootmybatis.demo.domain.TestPOJO;
import com.springbootmybatis.demo.service.TestService;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import org.springframework.web.bind.annotation.RestController;



/**
 * User: keer-dkx
 * date: ${Date}
 * Time：${Time}
 */
@RestController
public class TestController {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);
    @Autowired
    //自动装备，可以创建的时候不用赋初值，自动赋值，我的初步理解
    private TestService testServices;

    @RequestMapping("/sayhi")
    public String sayhi(){
        return "hello12444";
    }

    @RequestMapping(value = "/show")
    //如果请求地址是/show，返回的函数如下
    public TestPOJO show(@RequestParam ("id")long id){

        return testServices.findByid(id);
    }


}
